<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>访问对象属性</title>
</head>

<body>
    <p>有两种方式可以访问对象属性：</p>
    <p>你可以使用 .property 或者 ["property"]。</p>
    <p id="demo"></p>
    <script>
        var person = {
            firstName: "John",
            lastName: "Doe",
            id: 5566
        };
        document.getElementById("demo").innerHTML = person.firstName + " " + person.lastName;
    </script>
</body>

</html>